$(document).ajaxError(function (event,xhr,options,exc){
if (xhr.status==400){
    alert("参数校验失败");
}else if(xhr.status==401){
    alert("用户未登入,跳转到登入页面");
    location.href="blog_login.html";
}
});
$(document).ajaxSend(function (e,xhr,opt){
    var user_jwt=localStorage.getItem("user-token");
    xhr.setRequestHeader("user-token",user_jwt);
});

function getUserInfo(userUrl){
    $.ajax({
        type:"get",
        url:userUrl,
        success :function (result){
            $(".left .card h3").text(result.data.userName);
            $(".left .card a").attr(result.data.githubUrl);
        },
        error(){
            alert("获取信息失败");
        }
    });
}
function logout(){
    //删除Cookie
    localStorage.removeItem("user-token");
    location.href="blog_login.html";
};